<?php

namespace App\Model\Product;

use App\Dao\Product\StoreProductDescriptionDao;
use App\Model\Model;
use Hyperf\Database\Model\Relations\HasMany;
use Hyperf\Database\Model\SoftDeletes;

/**
 * @property integer $id
 * @property integer $mer_id
 * @property string $image
 * @property string $recommend_image
 * @property string $slider_image
 * @property string $store_name
 * @property string $store_info
 * @property string $keyword
 * @property string $bar_code
 * @property string $cate_id
 * @property decimal $price
 * @property decimal $vip_price
 * @property decimal $ot_price
 * @property decimal $postage
 * @property string $unit_name
 * @property smallint $sort
 * @property integer $sales
 * @property integer $stock
 * @property boolean $is_show
 * @property boolean $is_hot
 * @property boolean $is_benefit
 * @property boolean $is_best
 * @property boolean $is_new
 * @property boolean $is_virtual
 * @property boolean $virtual_type
 * @property integer $add_time
 * @property boolean $is_postage
 * @property boolean $is_del
 * @property boolean $mer_use
 * @property decimal $give_integral
 * @property decimal $cost
 * @property boolean $is_seckill
 * @property boolean $is_bargain
 * @property boolean $is_good
 * @property boolean $is_sub
 * @property boolean $is_vip
 * @property integer $ficti
 * @property integer $browse
 * @property string $code_path
 * @property string $soure_link
 * @property string $video_link
 * @property integer $temp_id
 * @property boolean $spec_type
 * @property string $activity
 * @property string $spu
 * @property string $label_id
 * @property string $command_word
 * @property string $recommend_list
 * @property boolean $vip_product
 * @property boolean $presale
 * @property integer $presale_start_time
 * @property integer $presale_end_time
 * @property integer $presale_day
 * @property string $logistics
 * @property boolean $freight
 * @property string $custom_form
 */
class StoreProduct extends Model
{
    use SoftDeletes;

    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'store_product';

    protected $fillable = [
        'mer_id',
        'image',
        'recommend_image',
        'slider_image',
        'store_name',
        'store_info',
        'keyword',
        'bar_code',
        'cate_id',
        'price',
        'vip_price',
        'ot_price',
        'postage',
        'unit_name',
        'sort',
        'sales',
        'stock',
        'is_show',
        'is_hot',
        'is_benefit',
        'is_best',
        'is_new',
        'is_virtual',
        'virtual_type',
        'add_time',
        'is_postage',
        'is_del',
        'mer_use',
        'give_integral',
        'cost',
        'is_seckill',
        'is_bargain',
        'is_good',
        'is_sub',
        'is_vip',
        'ficti',
        'browse',
        'code_path',
        'soure_link',
        'video_link',
        'temp_id',
        'spec_type',
        'activity',
        'spu',
        'label_id',
        'command_word',
        'recommend_list',
        'vip_product',
        'presale',
        'presale_start_time',
        'presale_end_time',
        'presale_day',
        'logistics',
        'freight',
        'custom_form',
    ];

    public function StoreProductAttrValue(): HasMany
    {
        return $this->hasMany(StoreProductAttrValue::class, 'product_id', 'id');
    }

    public function StoreProductAttr()
    {
        return $this->hasMany(StoreProductAttr::class, 'product_id', 'id');
    }

    public function StoreProductAttrResult()
    {
        return $this->hasOne(StoreProductAttrResult::class, 'product_id', 'id');
    }

    public function StoreProductDescription()
    {
        return $this->hasOne(StoreProductDescription::class, 'product_id', 'id');
    }

    public function StoreProductCate(){
        return $this->hasMany(StoreProductCate::class, 'product_id', 'id');
    }
}
